<%@page import="study.top.mydb.WishListProduct"%>
<%@page import="study.top.mydb.Category1"%>
<%@page import="study.top.mydb.Product"%>
<%@page import="study.top.common.PatternChecker"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page trimDirectiveWhitespaces="true"%>
<%@ page session="true"%>
<%@ include file="dbcon.jsp"%>

<%
	db.connect();
	// add에 필요한 모든 파라미터 받기
	String me_seq = request.getParameter("mem_seq");
	String pseq = request.getParameter("prono");
	String rank = request.getParameter("rank");
	String qty = request.getParameter("qty");
	
	/** 파라미터의 유효성 검사 */
	if (!PatternChecker.getInstance().isValue(pseq)) {
		out.print("<script type='text/javascript'>alert('name 파라미터가 없습니다.');history.back();</script>");
		return;
	}
	if (!PatternChecker.getInstance().isValue(rank)) {
		out.print("<script type='text/javascript'>alert('name 파라미터가 없습니다.');history.back();</script>");
		return;
	}

	if (pseq.equals("")) {
		qty += 1;
	}
	int mem_seq = Integer.parseInt(me_seq);
	int pseq1 = Integer.parseInt(pseq);
	int rank1 = Integer.parseInt(rank);
	int qty1 = Integer.parseInt(qty);
%>

<%
	if (mem_seq < 1) {
		out.print("<script type='text/javascript'>alert('로그인 해주세요.');window.location='uMemLogin.jsp';</script>");

	}
	/** 데이터 저장 */
	WishListProduct wishlistproduct = new WishListProduct();
	int seq = wishlistproduct.add(mem_seq, pseq1, rank1, qty1);

	/** 접속 해제 */
	DBHandler.getInstance().disconnect();
%>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset=UTF-8 />
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>우선순위</title>

<!-- 모바일 웹 페이지 설정 -->
<link rel="shortcut icon" href="assets/ico/favicon.png" />
<link rel="apple-touch-icon-precomposed"
	href="assets/ico/apple-touch-icon-57-precomposed.png" />
<link rel="apple-touch-icon-precomposed" sizes="72x72"
	href="assets/ico/apple-touch-icon-72-precomposed.png" />
<link rel="apple-touch-icon-precomposed" sizes="114x114"
	href="assets/ico/apple-touch-icon-114-precomposed.png" />
<link rel="apple-touch-icon-precomposed" sizes="144x144"
	href="assets/ico/apple-touch-icon-144-precomposed.png" />

<!-- bootstrap -->
<link rel="stylesheet" type="text/css"
	href="assets/css/bootstrap.min.css" />
<!-- Top makes css file -->
<link rel="stylesheet" type="text/css" href="assets/css/topCommon.css" />
<!-- 나눔고딕 웹 폰트 적용 -->
<link rel="stylesheet" type="text/css" href="assets/css/nanumfont.css" />
<!-- 반응형 웹을 지원하지 않을 경우 -->
<!-- <link rel="stylesheet" href="assets/css/non-responsive.css" /> -->

<!-- IE8 이하 버전 지원 -->
<!--[if lt IE 9]>
		<script type="text/javascript" src="assets/js/html5shiv.js"></script>
		<script type="text/javascript" src="assets/js/respond.min.js"></script>
		<![endif]-->

<!-- IE10 반응형 웹 버그 보완 -->
<!--[if gt IE 9]>
		<link rel="stylesheet" type="text/css" href="assets/css/ie10.css" />
		<script type="text/javascript" src="assets/js/ie10.js"></script>
		<![endif]-->
</head>


<body>
	<div class="container">
		<div class="page-header">
			<h5 class="top-center"><br/>
				상품이 추가되었습니다.<br/><br/>
			</h5>
		</div>
	
			&nbsp;&nbsp;&nbsp; <a
				id="topmainpage.jsp" onclick="rank();"
				class="btn btn-sm btn-custom" >쇼핑계속하기 </a>
			&nbsp;&nbsp;<a
				id="uWishList.jsp" onclick="rank();"
				class="btn btn-sm btn-custom" >위시리스트</a>
			&nbsp;&nbsp;
		
	</div>
	<script src="assets/js/jquery.js"></script>
	<script src="assets/js/bootstrap.min.js"></script>
	<script src="assets/js/string.js"></script>

	<script type="text/javascript">
		$(function rank() {
			//a태그 클릭시 id로받아온 jsp페이지로 넘기는 동시에 팝업꺼짐
			$("a").click(function() {
				var url = $(this).attr("id");
				window.opener.location = url;
				self.close();
			});
		});
	</script>
</body>

</html>

